//
//  NEDAppNetworkDelegate.h
//  NEDApp
//
//  Created by 98du on 2021/12/16.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN
/// 网络请求
@protocol NEDAppNetworkDelegate <NSObject>

@required
/// 默认发起请求的域名
- (NSString *)http_defaultDomain;

- (void)http_handleErrorCode:(NSInteger)errorCode
          responseStatusCode:(NSInteger)responseStatusCode
                     message:(NSString * _Nullable)message
                     request:(__kindof NSObject *)request;

/// 请求头公用配置
- (NSDictionary <NSString *,NSString *>*)http_requestHeaderFieldValuePublic;

@optional

/// 成功状态下返回的message 看是否需要HUD
- (void)http_HUDSuccessMessage:(NSString * _Nullable)message;

- (NSString*)http_codeStr:(NSInteger)code;

/// 参数加密
- (NSDictionary *)http_parameterEncryption:(NSDictionary *)parame;
/// 文件上传参数加密
- (NSDictionary *)http_fileUploadParameterEncryption:(NSDictionary *)parame;
/// 请求头参数加密
- (NSMutableDictionary <NSString *,NSString *>*)http_requestHeaderParameterEncryption:(NSMutableDictionary <NSString *,NSString *>*)parame;

/// 通过请求成功状态下返回的code 判断该请求是否算请求成功状态
- (BOOL)http_requestIsSuccessWithResponseCode:(NSInteger)code;


/// 开始请求
- (void)http_requestStart:(__kindof NSObject *)request;
/// 结束请求
- (void)http_requestEnd:(__kindof NSObject *)request;
/// 请求成功
- (void)http_requestSuccess:(__kindof NSObject *)request response:(__kindof NSObject *)response;
/// 请求失败
- (void)http_requestFail:(__kindof NSObject *)request response:(__kindof NSObject *)response;

@end

NS_ASSUME_NONNULL_END
